
/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package Apusic.impl;

import Apusic.ApusicPackage;
import Apusic.OS;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;
import javax.management.ObjectName;
import org.eclipse.emf.ecore.EObject;
import com.apusic.admin.config.*;
import com.apusic.admin.*;

import cn.edu.pku.sei.ra.wrapping.CommonWrapping.WrappingEObject;
import cn.edu.pku.sei.ra.wrapping.CommonWrapping.impl.WrappingEObjectImpl;
import cn.edu.pku.sei.ra.wrapping.CommonWrapping.util.EObjectContainmentEListForWrapping;
import cn.edu.pku.sei.ra.wrapping.CommonWrapping.util.EObjectResolvingEListForWrapping;
import cn.edu.pku.sei.ra.wrapping.CommonWrapping.util.ImagePool;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;
/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>OS</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link Apusic.impl.OSImpl#getName <em>Name</em>}</li>
 *   <li>{@link Apusic.impl.OSImpl#getVersion <em>Version</em>}</li>
 *   <li>{@link Apusic.impl.OSImpl#getTotalPhysicalMemorySize <em>Total Physical Memory Size</em>}</li>
 *   <li>{@link Apusic.impl.OSImpl#getFreePhysicalMemorySize <em>Free Physical Memory Size</em>}</li>
 *   <li>{@link Apusic.impl.OSImpl#getCommittedVirtualMemorySize <em>Committed Virtual Memory Size</em>}</li>
 *   <li>{@link Apusic.impl.OSImpl#getProcessCpuTime <em>Process Cpu Time</em>}</li>
 *   <li>{@link Apusic.impl.OSImpl#getAvailableProcessors <em>Available Processors</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class OSImpl extends WrappingEObjectImpl implements OS
{
  /**
   * The default value of the '{@link #getName() <em>Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getName()
   * @generated
   * @ordered
   */
  protected static final String NAME_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getName()
   * @generated
   * @ordered
   */
  protected String name = NAME_EDEFAULT;

  /**
   * The default value of the '{@link #getVersion() <em>Version</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getVersion()
   * @generated
   * @ordered
   */
  protected static final String VERSION_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getVersion() <em>Version</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getVersion()
   * @generated
   * @ordered
   */
  protected String version = VERSION_EDEFAULT;

  /**
   * The default value of the '{@link #getTotalPhysicalMemorySize() <em>Total Physical Memory Size</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTotalPhysicalMemorySize()
   * @generated
   * @ordered
   */
  protected static final long TOTAL_PHYSICAL_MEMORY_SIZE_EDEFAULT = 0L;

  /**
   * The cached value of the '{@link #getTotalPhysicalMemorySize() <em>Total Physical Memory Size</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getTotalPhysicalMemorySize()
   * @generated
   * @ordered
   */
  protected long totalPhysicalMemorySize = TOTAL_PHYSICAL_MEMORY_SIZE_EDEFAULT;

  /**
   * The default value of the '{@link #getFreePhysicalMemorySize() <em>Free Physical Memory Size</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getFreePhysicalMemorySize()
   * @generated
   * @ordered
   */
  protected static final long FREE_PHYSICAL_MEMORY_SIZE_EDEFAULT = 0L;

  /**
   * The cached value of the '{@link #getFreePhysicalMemorySize() <em>Free Physical Memory Size</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getFreePhysicalMemorySize()
   * @generated
   * @ordered
   */
  protected long freePhysicalMemorySize = FREE_PHYSICAL_MEMORY_SIZE_EDEFAULT;

  /**
   * The default value of the '{@link #getCommittedVirtualMemorySize() <em>Committed Virtual Memory Size</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getCommittedVirtualMemorySize()
   * @generated
   * @ordered
   */
  protected static final long COMMITTED_VIRTUAL_MEMORY_SIZE_EDEFAULT = 0L;

  /**
   * The cached value of the '{@link #getCommittedVirtualMemorySize() <em>Committed Virtual Memory Size</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getCommittedVirtualMemorySize()
   * @generated
   * @ordered
   */
  protected long committedVirtualMemorySize = COMMITTED_VIRTUAL_MEMORY_SIZE_EDEFAULT;

  /**
   * The default value of the '{@link #getProcessCpuTime() <em>Process Cpu Time</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getProcessCpuTime()
   * @generated
   * @ordered
   */
  protected static final long PROCESS_CPU_TIME_EDEFAULT = 0L;

  /**
   * The cached value of the '{@link #getProcessCpuTime() <em>Process Cpu Time</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getProcessCpuTime()
   * @generated
   * @ordered
   */
  protected long processCpuTime = PROCESS_CPU_TIME_EDEFAULT;

  /**
   * The default value of the '{@link #getAvailableProcessors() <em>Available Processors</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getAvailableProcessors()
   * @generated
   * @ordered
   */
  protected static final int AVAILABLE_PROCESSORS_EDEFAULT = 0;

  /**
   * The cached value of the '{@link #getAvailableProcessors() <em>Available Processors</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getAvailableProcessors()
   * @generated
   * @ordered
   */
  protected int availableProcessors = AVAILABLE_PROCESSORS_EDEFAULT;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected OSImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return ApusicPackage.Literals.OS;
  }

  
  

  
  
  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */ 
   public boolean isForCore(Object arg0){
   	boolean result=true;
   	if(core==null) return false;
    try{
    result=true;
    }
    catch(Exception e){
      result=false;
    }
    return result;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */ 
  public List listSubCores(int featureID){
    List result=new ArrayList();
  
    OSConfig core=(OSConfig)this.getCore();
    if(core==null) 
      return result;
    switch(featureID){
    
  
  
  
  
  
  
  
  }
    return result;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */ 
  public EClass getChildClassMap(Object object){
    ApusicPackage pack=ApusicPackage.eINSTANCE;	
  
  
  
  
  
  
  
  
    return null;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getName()
  {
        Object result=null;
        OSConfig core=(OSConfig)getCore();
        if(core==null) return name;	
        try
{
name=core.getName();
}
catch(Exception e)
{
  name = null;
}
    return name; 
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setName(String newName)
  {
    String oldName = name;
    name = newName;
        	
      OSConfig core=(OSConfig)getCore();
      if(core==null) return;
      	
        
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ApusicPackage.OS__NAME, oldName, name));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getVersion()
  {
        Object result=null;
        OSConfig core=(OSConfig)getCore();
        if(core==null) return version;	
        try
{
version=core.getVersion();
}
catch(Exception e)
{
  version = null;
}
    return version; 
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setVersion(String newVersion)
  {
    String oldVersion = version;
    version = newVersion;
        	
      OSConfig core=(OSConfig)getCore();
      if(core==null) return;
      	
        
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ApusicPackage.OS__VERSION, oldVersion, version));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public long getTotalPhysicalMemorySize()
  {
        Object result=null;
        OSConfig core=(OSConfig)getCore();
        if(core==null) return totalPhysicalMemorySize;	
        try
{
totalPhysicalMemorySize=core.getTotalPhysicalMemorySize();
}
catch(Exception e)
{
  totalPhysicalMemorySize = -1;
}
    return totalPhysicalMemorySize; 
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setTotalPhysicalMemorySize(long newTotalPhysicalMemorySize)
  {
    long oldTotalPhysicalMemorySize = totalPhysicalMemorySize;
    totalPhysicalMemorySize = newTotalPhysicalMemorySize;
        	
      OSConfig core=(OSConfig)getCore();
      if(core==null) return;
      	
        
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ApusicPackage.OS__TOTAL_PHYSICAL_MEMORY_SIZE, oldTotalPhysicalMemorySize, totalPhysicalMemorySize));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public long getFreePhysicalMemorySize()
  {
        Object result=null;
        OSConfig core=(OSConfig)getCore();
        if(core==null) return freePhysicalMemorySize;	
        try
{
freePhysicalMemorySize=core.getFreePhysicalMemorySize();
}
catch(Exception e)
{
  freePhysicalMemorySize = -1;
}
    return freePhysicalMemorySize; 
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setFreePhysicalMemorySize(long newFreePhysicalMemorySize)
  {
    long oldFreePhysicalMemorySize = freePhysicalMemorySize;
    freePhysicalMemorySize = newFreePhysicalMemorySize;
        	
      OSConfig core=(OSConfig)getCore();
      if(core==null) return;
      	
        
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ApusicPackage.OS__FREE_PHYSICAL_MEMORY_SIZE, oldFreePhysicalMemorySize, freePhysicalMemorySize));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public long getCommittedVirtualMemorySize()
  {
        Object result=null;
        OSConfig core=(OSConfig)getCore();
        if(core==null) return committedVirtualMemorySize;	
        try
{
committedVirtualMemorySize=core.getCommittedVirtualMemorySize();
}
catch(Exception e)
{
  committedVirtualMemorySize = -1;
}
    return committedVirtualMemorySize; 
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setCommittedVirtualMemorySize(long newCommittedVirtualMemorySize)
  {
    long oldCommittedVirtualMemorySize = committedVirtualMemorySize;
    committedVirtualMemorySize = newCommittedVirtualMemorySize;
        	
      OSConfig core=(OSConfig)getCore();
      if(core==null) return;
      	
        
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ApusicPackage.OS__COMMITTED_VIRTUAL_MEMORY_SIZE, oldCommittedVirtualMemorySize, committedVirtualMemorySize));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public long getProcessCpuTime()
  {
        Object result=null;
        OSConfig core=(OSConfig)getCore();
        if(core==null) return processCpuTime;	
        try
{
processCpuTime=core.getProcessCpuTime();
}
catch(Exception e)
{
  processCpuTime = -1;
}
    return processCpuTime; 
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setProcessCpuTime(long newProcessCpuTime)
  {
    long oldProcessCpuTime = processCpuTime;
    processCpuTime = newProcessCpuTime;
        	
      OSConfig core=(OSConfig)getCore();
      if(core==null) return;
      	
        
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ApusicPackage.OS__PROCESS_CPU_TIME, oldProcessCpuTime, processCpuTime));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public int getAvailableProcessors()
  {
        Object result=null;
        OSConfig core=(OSConfig)getCore();
        if(core==null) return availableProcessors;	
        try
{
availableProcessors=core.getAvailableProcessors();
}
catch(Exception e)
{
  availableProcessors = -1;
}
    return availableProcessors; 
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setAvailableProcessors(int newAvailableProcessors)
  {
    int oldAvailableProcessors = availableProcessors;
    availableProcessors = newAvailableProcessors;
        	
      OSConfig core=(OSConfig)getCore();
      if(core==null) return;
      	
        
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, ApusicPackage.OS__AVAILABLE_PROCESSORS, oldAvailableProcessors, availableProcessors));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case ApusicPackage.OS__NAME:
        return getName();
      case ApusicPackage.OS__VERSION:
        return getVersion();
      case ApusicPackage.OS__TOTAL_PHYSICAL_MEMORY_SIZE:
        return new Long(getTotalPhysicalMemorySize());
      case ApusicPackage.OS__FREE_PHYSICAL_MEMORY_SIZE:
        return new Long(getFreePhysicalMemorySize());
      case ApusicPackage.OS__COMMITTED_VIRTUAL_MEMORY_SIZE:
        return new Long(getCommittedVirtualMemorySize());
      case ApusicPackage.OS__PROCESS_CPU_TIME:
        return new Long(getProcessCpuTime());
      case ApusicPackage.OS__AVAILABLE_PROCESSORS:
        return new Integer(getAvailableProcessors());
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case ApusicPackage.OS__NAME:
        setName((String)newValue);
        return;
      case ApusicPackage.OS__VERSION:
        setVersion((String)newValue);
        return;
      case ApusicPackage.OS__TOTAL_PHYSICAL_MEMORY_SIZE:
        setTotalPhysicalMemorySize(((Long)newValue).longValue());
        return;
      case ApusicPackage.OS__FREE_PHYSICAL_MEMORY_SIZE:
        setFreePhysicalMemorySize(((Long)newValue).longValue());
        return;
      case ApusicPackage.OS__COMMITTED_VIRTUAL_MEMORY_SIZE:
        setCommittedVirtualMemorySize(((Long)newValue).longValue());
        return;
      case ApusicPackage.OS__PROCESS_CPU_TIME:
        setProcessCpuTime(((Long)newValue).longValue());
        return;
      case ApusicPackage.OS__AVAILABLE_PROCESSORS:
        setAvailableProcessors(((Integer)newValue).intValue());
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case ApusicPackage.OS__NAME:
        setName(NAME_EDEFAULT);
        return;
      case ApusicPackage.OS__VERSION:
        setVersion(VERSION_EDEFAULT);
        return;
      case ApusicPackage.OS__TOTAL_PHYSICAL_MEMORY_SIZE:
        setTotalPhysicalMemorySize(TOTAL_PHYSICAL_MEMORY_SIZE_EDEFAULT);
        return;
      case ApusicPackage.OS__FREE_PHYSICAL_MEMORY_SIZE:
        setFreePhysicalMemorySize(FREE_PHYSICAL_MEMORY_SIZE_EDEFAULT);
        return;
      case ApusicPackage.OS__COMMITTED_VIRTUAL_MEMORY_SIZE:
        setCommittedVirtualMemorySize(COMMITTED_VIRTUAL_MEMORY_SIZE_EDEFAULT);
        return;
      case ApusicPackage.OS__PROCESS_CPU_TIME:
        setProcessCpuTime(PROCESS_CPU_TIME_EDEFAULT);
        return;
      case ApusicPackage.OS__AVAILABLE_PROCESSORS:
        setAvailableProcessors(AVAILABLE_PROCESSORS_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case ApusicPackage.OS__NAME:
        return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
      case ApusicPackage.OS__VERSION:
        return VERSION_EDEFAULT == null ? version != null : !VERSION_EDEFAULT.equals(version);
      case ApusicPackage.OS__TOTAL_PHYSICAL_MEMORY_SIZE:
        return totalPhysicalMemorySize != TOTAL_PHYSICAL_MEMORY_SIZE_EDEFAULT;
      case ApusicPackage.OS__FREE_PHYSICAL_MEMORY_SIZE:
        return freePhysicalMemorySize != FREE_PHYSICAL_MEMORY_SIZE_EDEFAULT;
      case ApusicPackage.OS__COMMITTED_VIRTUAL_MEMORY_SIZE:
        return committedVirtualMemorySize != COMMITTED_VIRTUAL_MEMORY_SIZE_EDEFAULT;
      case ApusicPackage.OS__PROCESS_CPU_TIME:
        return processCpuTime != PROCESS_CPU_TIME_EDEFAULT;
      case ApusicPackage.OS__AVAILABLE_PROCESSORS:
        return availableProcessors != AVAILABLE_PROCESSORS_EDEFAULT;
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (name: ");
    result.append(name);
    result.append(", version: ");
    result.append(version);
    result.append(", totalPhysicalMemorySize: ");
    result.append(totalPhysicalMemorySize);
    result.append(", freePhysicalMemorySize: ");
    result.append(freePhysicalMemorySize);
    result.append(", committedVirtualMemorySize: ");
    result.append(committedVirtualMemorySize);
    result.append(", processCpuTime: ");
    result.append(processCpuTime);
    result.append(", availableProcessors: ");
    result.append(availableProcessors);
    result.append(')');
    return result.toString();
  }

} //OSImpl
